﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace Nvigorate.Data.Query
{
    [Serializable]
    public class IfBlock : IQueryObject
    {
        protected SearchCriteria _criteria;
        protected IQueryObject _ifTrue;
        protected IQueryObject _ifFalse;

        public SearchCriteria Criteria
        {
            get { return _criteria; }
            set { _criteria = value; }
        }

        public IQueryObject ActionIfTrue
        {
            get { return _ifTrue; }
            set { _ifTrue = value; }
        }

        public IQueryObject ActionIfFalse
        {
            get { return _ifFalse; }
            set { _ifFalse = value; }
        }

        public static IfBlock Condition(SearchCriteria condition)
        {
            return new IfBlock(){_criteria = condition};
        }

        public IfBlock IfTrue(IQueryObject action)
        {
            _ifTrue = action;
            return this;
        }

        public IfBlock IfFalse(IQueryObject action)
        {
            _ifFalse = action;
            return this;
        }

        public XElement GetXElementRepresentation()
        {
            throw new System.NotImplementedException();
        }

        public object ParseXElement(XElement element)
        {
            throw new System.NotImplementedException();
        }
    }
}
